home *** CD-ROM | disk | FTP | other *** search
/ Halting the Hacker - A P…uide to Computer Security / Halting the Hacker - A Practical Guide to Computer Security.iso / rfc / rfc1830.txt < prev    next >
Text File  |  1997-04-01  |  17KB  |  452 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                       G. Vaudreuil
  8. Request for Comments: 1830                        Octel Network Services
  9. Category: Experimental                                       August 1995
  10.  
  11.  
  12.                         SMTP Service Extensions
  13.                        for Transmission of Large
  14.                         and Binary MIME Messages
  15.  
  16. Status of this Memo
  17.  
  18.    This memo defines an Experimental Protocol for the Internet
  19.    community.  This memo does not specify an Internet standard of any
  20.    kind.  Discussion and suggestions for improvement are requested.
  21.    Distribution of this memo is unlimited.
  22.  
  23. 1. Abstract
  24.  
  25.    This memo defines two extensions to the SMTP service.  The first
  26.    service enables a SMTP client and server to negotiate the use of an
  27.    alternate DATA command "BDAT" for efficiently sending large MIME
  28.    messages.  The second extension takes advantage of the BDAT command
  29.    to permit the negotiated sending of unencoded binary data.
  30.  
  31. 2. Introduction
  32.  
  33.    The MIME extensions to the Internet message protocol provides for the
  34.    transmission of many kinds of data which were previously unsupported
  35.    in Internet mail.  Anticipating the need to more efficiently
  36.    transport the new media made possible with MIME, the SMTP protocol
  37.    has been extended to provide transport for new message types.  RFC
  38.    1426 defines one such extension for the transmission of unencoded 8
  39.    bit MIME messages [8BIT].  This service extension permits the
  40.    receiver SMTP to declare support for 8 bit body parts and the sender
  41.    to request 8 bit transmission of a particular message.
  42.  
  43.    One expected result of the use of MIME is that the Internet mail
  44.    system will be expected to carry very large mail messages.  In such
  45.    transactions, there is a need to eliminate the requirement that the
  46.    message be scanned for "CR LF . CR LF" sequences upon sending and
  47.    receiving to detect the end of message.
  48.  
  49.    Independent of the need to send large messages, Internet mail is
  50.    increasingly multi-media there is a need to avoid the overhead of
  51.    base64 and quoted-printable encoding of binary objects sent using the
  52.    MIME message format over SMTP between hosts which support binary
  53.    message processing.
  54.  
  55.  
  56.  
  57.  
  58. Vaudreuil                     Experimental                      [Page 1]
  59.  
  60. RFC 1830           Binary and Large Message Transport        August 1995
  61.  
  62.  
  63.    This memo uses the mechanism defined in [ESMTP] to define two
  64.    extensions to the SMTP service whereby a client ("sender-SMTP") may
  65.    declare support for the message chunking transmission mode using the
  66.    BDAT command and support for the sending of Binary messages.
  67.  
  68. 3. Framework for the Large Message Extensions
  69.  
  70.    The following service extension is hereby defined:
  71.  
  72.           1) The name of the data chunking service extension is
  73.           "CHUNKING".
  74.  
  75.           2) The EHLO keyword value associated with this extension is
  76.           "CHUNKING".
  77.  
  78.           3) A new SMTP verb is defined "BDAT" as an alternative to
  79.           the "DATA" command of [RFC821]. The BDAT verb takes two
  80.           arguments.  The first argument indicates the length of the
  81.           binary data packet.  The second optional argument indicates
  82.           that the data packet is the last.
  83.  
  84.                bdat-cmd   ::= "BDAT" SP chunk-size
  85.                               [ SP end-marker ] CR LF
  86.                chunk-size ::= 1*DIGIT
  87.                end-marker ::= "LAST"
  88.  
  89.  
  90.    The CHUNKING service extension enables the use of the BDAT
  91.    alternative to the DATA command.  This extension can be used for any
  92.    message, whether 7 bit, 8BITMIME or BINARYMIME.
  93.  
  94.    When a client SMTP wishes to submit (using the MAIL command) a large
  95.    message using the CHUNKING extension, it first issues the EHLO
  96.    command to the server SMTP.  If the server SMTP responds with code
  97.    250 to the EHLO command, and the response includes the EHLO keyword
  98.    value CHUNKING, then the server SMTP is indicating that it supports
  99.    the BDAT command and will accept the sending of messages in chunks.
  100.  
  101.    After all MAIL FROM and RCPT TO responses are collected and
  102.    processed, the message is sent using a series of BDAT commands.  The
  103.    BDAT command takes one argument, the exact length of the data segment
  104.    in octets.  The message data is sent immediately after the BDAT
  105.    command.  Once the receiver-SMTP receives the specified number of
  106.    octets, it will return a 250 reply code.
  107.  
  108.    The LAST parameter on the BDAT command indicates that this is the
  109.    last chunk of message data to be sent.  Any BDAT command sent after
  110.    the BDAT LAST is illegal and must be replied to with a 503 "Bad
  111.  
  112.  
  113.  
  114. Vaudreuil                     Experimental                      [Page 2]
  115.  
  116. RFC 1830           Binary and Large Message Transport        August 1995
  117.  
  118.  
  119.    sequence of commands" reply code. The state resulting from this error
  120.    is indeterminate.  A RSET command must be sent to clear the
  121.    transaction before continuing.
  122.  
  123.    A 250 response should be sent to each BDAT data block.  If a 5XX code
  124.    is sent in response to a BDAT chunk the message should be considered
  125.    failed and, the sender SMTP must not send any additional BDAT
  126.    segments.  If using the ESMTP pipelining extensions [PIPE], the
  127.    sender SMTP must complete the sending of the current segment and not
  128.    send any more BDATs.  When streaming, the receiver SMTP must accept
  129.    and discard additional BDAT chunks after the failed BDAT.  After
  130.    receiving a 5XX error in response to a BDAT command, the resulting
  131.    state is indeterminate.  A RSET command must be issued to clear the
  132.    transaction before additional commands may be sent.
  133.  
  134.       Note that an error on the receiver SMTP such as disk full or
  135.       imminent shutdown can only be reported after the BDAT segment has
  136.       been sent.  It is therefore important to choose a reasonable chunk
  137.       size given the expected end to end bandwidth.
  138.  
  139.    The RSET command when issued during after the first BDAT and before
  140.    the BDAT LAST clears all segments sent during that transaction and
  141.    resets the session.
  142.  
  143.    DATA and BDAT commands cannot be used in the same transaction.  If a
  144.    DATA statement is issued after a BDAT for the current transaction, a
  145.    503 "Bad sequence of commands" must be issued.  The state resulting
  146.    from this error is indeterminate.  A RSET command must be sent to
  147.    clear the transaction before continuing.  There is no prohibition on
  148.    using DATA and BDAT in the same session, so long as they are not
  149.    mixed in the same transaction.
  150.  
  151.    The local storage size of a message may not accurately reflect the
  152.    actual size of the message sent due to local storage conventions.  In
  153.    particular, text messages sent with the BDAT command must be sent in
  154.    the canonical MIME format with lines delimited with a <CR><LF>.  It
  155.    may not be possible to convert the entire message to the canonical
  156.    format at once. Chunking provides a mechanism to convert the message
  157.    to canonical form, accurately count the bytes, and send the message a
  158.    single chunk at a time.
  159.  
  160.       Note that correct byte counting is essential.  If too many bytes
  161.       are indicated by the sender SMTP, the receiver SMTP will continue
  162.       to wait for the remainder of the data or will read the subsequent
  163.       command as additional message data.  In the case where a portion
  164.       of the previous command was read as data, the parser will return a
  165.       syntax error when the incomplete command is read.
  166.  
  167.  
  168.  
  169.  
  170. Vaudreuil                     Experimental                      [Page 3]
  171.  
  172. RFC 1830           Binary and Large Message Transport        August 1995
  173.  
  174.  
  175.       If too few bytes are indicated by the sender SMTP, the receiver
  176.       SMTP will interpret the remainder of the message data as invalid
  177.       commands.  Note that the remainder of the message data may be
  178.       binary and as such lexigraphical parsers must be prepared to
  179.       receive, process, and reject lines of arbitrary octets.
  180.  
  181. 4. Framework for the Binary Service Extension
  182.  
  183.    The following service extension is hereby defined:
  184.  
  185.       1) The name of the binary service extension is "BINARYMIME".
  186.  
  187.       2) The EHLO keyword value associated with this extension is
  188.          "BINARYMIME".
  189.  
  190.       3) The BINARYMIME service extension can only be used with
  191.          the "CHUNKING" service extension.
  192.  
  193.       4) No parameter is used with the BINARYMIME keyword.
  194.  
  195.       5) One additional parameter to the BODY keyword defined
  196.          [8BIT] for the MAIL FROM command is defined, "BINARYMIME".
  197.          The value "BINARYMIME" associated with this parameter
  198.          indicates that this message is a Binary MIME message (in
  199.          strict compliance with [MIME]) with arbitrary octet content
  200.          being sent. The revised syntax of the value is as follows,
  201.          using the ABNF notation of [RFC822]:
  202.  
  203.          body-value ::= "7BIT" / "8BITMIME" / "BINARYMIME"
  204.  
  205.       6) No new verbs are defined for the BINARYMIME extension.
  206.  
  207.    A sender SMTP may request that a binary MIME message be sent without
  208.    transport encoding by sending a BINARYMIME parameter with the MAIL
  209.    FROM command.  When the receiver SMTP accepts a MAIL FROM command
  210.    with the BINARYMIME body type requested, it agrees to preserve all
  211.    bits in each octet passed using the BDAT command.
  212.  
  213.    BINARYMIME cannot be used with the DATA command.  If a DATA command
  214.    is issued after a MAIL FROM command containing the body-value of
  215.    "BINARYMIME", a 501 response should be sent.  The resulting state
  216.    from this error condition is indeterminate and the transaction should
  217.    be reset with the RSET command.
  218.  
  219.       It is important to note that when using BINARYMIME, it is
  220.       especially important to ensure that the MIME message itself is
  221.       properly formed.  In particular, it is essential that text be
  222.       canonically encoded with each line properly terminated with <CR>
  223.  
  224.  
  225.  
  226. Vaudreuil                     Experimental                      [Page 4]
  227.  
  228. RFC 1830           Binary and Large Message Transport        August 1995
  229.  
  230.  
  231.       <LF>.  Any transformation of text into non-canonical MIME to
  232.       observe local storage conventions must be reversed before sending
  233.       as BINARYMIME.  The usual line-oriented shortcuts will break if
  234.       used with BINARYMIME.
  235.  
  236.    The syntax of the extended MAIL command is identical to the MAIL
  237.    command in [RFC821], except that a BODY parameter must appear after
  238.    the address.  The complete syntax of this extended command is defined
  239.    in [ESMTP]. The ESMTP-keyword is BODY and the syntax for ESMTP-value
  240.    is given by the syntax for body-value in [ESMTP].
  241.  
  242.    If a receiver SMTP does not support the BINARYMIME message format
  243.    (either by not responding with code 250 to the EHLO command, or by
  244.    rejecting the BINARYMIME parameter to the MAIL FROM command, then the
  245.    client SMTP must not, under any circumstances, send binary data using
  246.    the DATA or BDAT commands.
  247.  
  248.    If the receiver-SMTP does not support BINARYMIME and the message
  249.    content is a MIME object with a binary encoding, a client SMTP has
  250.    two options in this case: first, it may implement a gateway
  251.    transformation to convert the message into valid 7bit encoded MIME,
  252.    or second, it may treat this as a permanent error and handle it in
  253.    the usual manner for delivery failures.  The specifics of the
  254.    transformation from Binary MIME to 7bit MIME are not described by
  255.    this RFC; the conversion is nevertheless constrained in the following
  256.    ways:
  257.  
  258.      o  The conversion must cause no loss of information; MIME
  259.         transport encodings must be employed as needed to insure this
  260.         is the case.
  261.  
  262.      o  The resulting message must be valid 7bit MIME.
  263.  
  264.    As of present there are no mechanisms for converting a binary MIME
  265.    object into a 8 bit-MIME object.  Such a transformation will require
  266.    the specification of a new MIME content-transfer-encoding, the
  267.    standardization of which is discouraged by [MIME].
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Vaudreuil                     Experimental                      [Page 5]
  283.  
  284. RFC 1830           Binary and Large Message Transport        August 1995
  285.  
  286.  
  287. 5. Examples
  288.  
  289. 5.1 Simple Chunking
  290.  
  291.    The following simple dialogue illustrates the use of the large
  292.    message extension to send a short psudo-RFC822 message to one
  293.    recipient using the CHUNKING extension:
  294.  
  295.  
  296.           R: <wait for connection on TCP port 25>
  297.           S: <open connection to server>
  298.           R: 220 cnri.reston.va.us SMTP service ready
  299.           S: EHLO ymir.claremont.edu
  300.           R: 250-cnri.reston.va.us says hello
  301.           R: 250 CHUNKING
  302.           S: MAIL FROM:<Sam@Random.com>
  303.           R: 250 <Sam@Random.com>... Sender ok
  304.           S: RCPT TO:<Susan@Random.com>
  305.           R: 250 <Susan@random.com>... Recipient ok
  306.           S: BDAT 69 LAST
  307.           S: To: Susan@random.com<CR><LF>
  308.           S: From: Sam@random.com<CR><LF>
  309.           S: Subject: This is a bodyless test message<CR><LF>
  310.           R: 250 Message OK, 69 octets received
  311.           S: QUIT
  312.           R: 221 Goodbye
  313.  
  314. 5.2 Pipelining Binarymime
  315.  
  316.    The following dialogue illustrates the use of the large message
  317.    extension to send a BINARYMIME object to two recipients using the
  318.    CHUNKING and PIPELINING extensions:
  319.  
  320.           R: <wait for connection on TCP port 25>
  321.           S: <open connection to server>
  322.           R: 220 cnri.reston.va.us SMTP service ready
  323.           S: EHLO ymir.claremont.edu
  324.           R: 250-cnri.reston.va.us says hello
  325.           R: 250-PIPELINING
  326.           R: 250-BINARYMIME
  327.           R: 250 CHUNKING
  328.           S: MAIL FROM:<ned@ymir.claremont.edu> BODY=BINARYMIME
  329.           S: RCPT TO:<gvaudre@cnri.reston.va.us>
  330.           S: RCPT TO:<jstewart@cnri.reston.va.us>
  331.           R: 250 <ned@ymir.claremont.edu>... Sender and BINARYMIME ok
  332.           R: 250 <gvaudre@cnri.reston.va.us>... Recipient ok
  333.           R: 250 <jstewart@cnri.reston.va.us>... Recipient ok
  334.           S: BDAT 100000
  335.  
  336.  
  337.  
  338. Vaudreuil                     Experimental                      [Page 6]
  339.  
  340. RFC 1830           Binary and Large Message Transport        August 1995
  341.  
  342.  
  343.           S: (First 10000 octets of canonical MIME message data)
  344.           S: BDAT 324 LAST
  345.           S: (Remaining 324 octets of canonical MIME message data)
  346.           R: 250 100000 bytes received
  347.           R: 250 Message OK, 100324 octets received
  348.           S: QUIT
  349.           R: 221 Goodbye
  350.  
  351. 6. Security Considerations
  352.  
  353.    This RFC does not discuss security issues and is not believed to
  354.    raise any security issues not already endemic in electronic mail and
  355.    present in fully conforming implementations of [RFC821], or otherwise
  356.    made possible by [MIME].
  357.  
  358. 7. Acknowledgments
  359.  
  360.    This document is the result of numerous discussions in the IETF SMTP
  361.    Extensions Working Group and in particular due to the continued
  362.    advocacy of "chunking" by Neil Katin.
  363.  
  364. 8. References
  365.  
  366.      [RFC821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC
  367.         821, USC/Information Sciences Institute, August 1982.
  368.  
  369.      [RFC822] Crocker, D., "Standard for the Format of ARPA Internet
  370.         Text Messages", STD 11, RFC 822, UDEL, August 1982.
  371.  
  372.      [MIME] Borenstein, N., and N. Freed, "Multipurpose Internet Mail
  373.         Extensions", RFC 1521, Bellcore, Innosoft, June 1992.
  374.  
  375.      [ESMTP] Klensin, J., WG Chair, Freed, N., Editor, Rose, M.,
  376.         Stefferud, E., and D. Crocker, "SMTP Service Extensions" RFC
  377.         1425, United Nations University, Innosoft International,
  378.         Inc., Dover Beach Consulting, Inc., Network Management
  379.         Associates, Inc., The Branch Office, February 1993.
  380.  
  381.      [8BIT] Klensin, J., WG Chair, Freed, N., Editor, Rose, M.,
  382.         Stefferud, E., and D. Crocker, "SMTP Service Extension for
  383.         8bit-MIMEtransport" RFC 1426, United Nations University,
  384.         Innosoft International, Inc., Dover Beach Consulting, Inc.,
  385.         Network Management Associates, Inc., The Branch Office,
  386.         February 1993.
  387.  
  388.      [PIPE] Freed, N., "SMTP Service Extensions for Command
  389.         Pipelining", Innosoft International, Work in Progress.
  390.  
  391.  
  392.  
  393.  
  394. Vaudreuil                     Experimental                      [Page 7]
  395.  
  396. RFC 1830           Binary and Large Message Transport        August 1995
  397.  
  398.  
  399. 9. Author's Address
  400.  
  401.    Gregory M. Vaudreuil
  402.    Octel Network Services
  403.    17060 Dallas Parkway
  404.    Suite 214
  405.    Dallas, TX 75248-1905
  406.  
  407.    Voice/Fax: 214-733-2722
  408.    EMail: Greg.Vaudreuil@Octel.com
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Vaudreuil                     Experimental                      [Page 8]
  451.  
  452.